<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});



//Route::get('backend/login', 'Auth\backend\LoginController@showLoginForm')->name('admin.login');
//Route::post('backend/login', 'Auth\backend\LoginController@login');
//Route::post('backend/logout', 'Auth\backend\LoginController@logout')->name('admin.logout');

Route::group(['prefix' => 'backend'],function(){

    Route::get('login', 'Auth\backend\LoginController@showLoginForm')->name('admin.login');
    Route::post('login', 'Auth\backend\LoginController@login');
    Route::get('logout', 'Auth\backend\LoginController@logout')->name('admin.logout');

    Route::any('{slug}','backend\Backend@init')->where('slug',"(?!login|logout)(.*)")->middleware('auth.admin:admin') ;

});

Route::any('backend/', 'backend\Backend@init')->middleware('auth.admin:admin');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
